import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nft_shop/my/page/set/details_web_page.dart';
import 'package:nft_shop/res/global.dart';
import 'package:nft_shop/widgets/load_image.dart';
import 'package:nft_shop/widgets/my_app_bar.dart';
import 'package:nft_shop/widgets/my_scroll_view.dart';

class MyAgreementPage extends StatefulWidget {
  const MyAgreementPage({Key? key}) : super(key: key);

  @override
  _MyAgreementPageState createState() => _MyAgreementPageState();
}

class _MyAgreementPageState extends State<MyAgreementPage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(
        centerTitle: "协议",
      ),
      body: MyScrollView(
        children: [
          MyAboutUsItem(title: "用户协议",onTap: () => Get.to(DetailsWebPage(name:"用户协议",)),),
          MyAboutUsItem(title: "购买协议",onTap: () => Get.to(DetailsWebPage(name:"购买协议",)),),
          MyAboutUsItem(title: "售卖协议",onTap: () => Get.to(DetailsWebPage(name:"售卖协议",)),),
        ],
      ),
    );
  }
}

class MyAboutUsItem extends StatelessWidget {
  final String title;
  final GestureTapCallback? onTap;

  MyAboutUsItem({required this.title,this.onTap,});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: Container(
        height: 57,
        decoration: BoxDecoration(
            border: Border(
              bottom: Divider.createBorderSide(context, width: 1,color: Global.kTheme.colorLine),
            )
        ),
        margin: const EdgeInsets.only(left: 14.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Padding(
              padding: const EdgeInsets.only(left: 6),
              child: Text(title,style: TextStyle(fontFamily: Global.mySemiboldFont,fontSize: 14,color: Global.kTheme.textPrimary8),),
            ),
            Padding(
              padding: const EdgeInsets.only(right: 20),
              child: LoadAssetImage("next_icon",width: 7,height: 12,),
            )
          ],
        ),
      ),
    );
  }
}
